package org.javia.arity;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class ByteStackTest {

	ByteStack stack;
	
	@Before
	public void setup(){
		stack= new ByteStack();
	}
	
	@Test
	public void testIsEmpty(){
		assertTrue(  stack.isEmpty());
	}
	
	@Test
	public void testClear() {
		stack.push((byte) 1);
		assertFalse(stack.isEmpty());
		stack.clear();
		assertTrue(  stack.isEmpty());
	}

	@Test
	public void testPushPop() {
	byte by=1;
	stack.push(by);
	byte b2= stack.pop();
	assertEquals(by,b2);
	stack.push(by);
	stack.push(by);
	stack.push(by);
	stack.push(by);
	stack.push(by);
	stack.push(by);
	stack.push(by);
	stack.push(by);
	stack.push(by);
	stack.push(by);
	}



	@Test
	public void testToArray() {
		byte[] bs= {(byte)1, (byte)2,(byte)3};
	stack.push(bs[0]);
	stack.push(bs[1]);
	stack.push(bs[2]);
	byte[] bs2= stack.toArray();
	for(int i=0;i<3;i++){
		assertEquals(bs[i],bs2[i]);
	}
	}

}
